// 防止重复提交指令

const prevent = {
  install(Vue, options) {
    Vue.directive('preventReClick', {
      inserted(el, binding) {
        el.addEventListener('click', () => {
          if (!el.disabled) {
            el.disabled = true
            setTimeout(() => {
              el.disabled = false
            }, binding.value || 3000)
          }
        })
      },
    })
  },
}
export default prevent
